-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jshint improvements #26
Jshint improvements #26
Conversation
`~~` operation is subtly different than `Math.floor`, it just removes anything right of the decimal. This results in a difference for negative numbers. Also, `~~` is much faster than `Math.floor`.
As a highly performance oriented library, we definitely need to use bitwise operations. - Removed no longer supported jshint properties - Remove several options that we're not using and are default to false - Also add separate .jshintrc for test folder that extends the root
"curly" : true, // Require {} for every new block or scope. | ||
"eqeqeq" : true, // Require triple equals i.e. `===`. | ||
"es3" : false, // Adhere to ECMAScript 3 specification for legacy browsers like Internet Explorer 6/7/8. | ||
"forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that should be false
and forEach
should be used instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The meaning of this is not which loop to use, but rather to enforce checking inside a for..in
loop which is meant to make you check hasOwnProperty
on keys of an object.
Also, forEach
is actually not as fast as a regular for loop http://jsperf.com/for-vs-foreach/313.
Jshint improvements
👍 |
In numbro 1.2.0 |
This continues the work started by @baer in adamwdraper/Numeral-js#100. I adjusted the original proposal to be a little less strict because we need things like bitwise operators.
What's here now seems like a good starting point so I'm opening this PR for a place of discussion for how strict jshint rules should be.